﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using System.Text.RegularExpressions;
using System.IO;
using System.Collections;

namespace AndroidEditor
{
    /// <summary>
    /// 
    /// </summary>
    /// <remarks></remarks>
    class ProjectSetting
    {
        /// <summary>
        /// 
        /// </summary>
        private NprojectType.PType thisPType = NprojectType.PType.静态库;
        /// <summary>
        /// 
        /// </summary>
        private NprojectType.CType thisCtype = NprojectType.CType.C;

        /// <summary>
        /// 
        /// </summary>
        private HeadSetting thishSetting = null;
        /// <summary>
        /// 
        /// </summary>
        private SourceSetting thisSetting = null;
        /// <summary>
        /// 
        /// </summary>
        private string pName = "";

        /// <summary>
        /// 
        /// </summary>
        private List<string> DependHeaderDirectory = new List<string>();
        /// <summary>
        /// 
        /// </summary>
        private List<string> DependLibsDirectory = new List<string>();
        /// <summary>
        /// 
        /// </summary>
        private Hashtable userlibs = new Hashtable();
        /// <summary>
        /// 
        /// </summary>
        private Hashtable userflags = new Hashtable();
        /// <summary>
        /// 
        /// </summary>
        private string OutDir = "";
        /// <summary>
        /// 
        /// </summary>
        private bool isJS = true;
        /// <summary>
        /// 
        /// </summary>
        private string VB = "";
        /// <summary>
        /// 
        /// </summary>
        private string JS = "";
        /// <summary>
        /// Initializes a new instance of the <see cref="ProjectSetting"/> class.
        /// </summary>
        /// <param name="pName">Name of the p.</param>
        /// <remarks></remarks>
        public ProjectSetting(string pName)
        {
            // TODO: Complete member initialization
            this.pName = pName; 
        }
        /// <summary>
        /// Sets the projecttype.
        /// </summary>
        /// <param name="pType">Type of the p.</param>
        /// <remarks></remarks>
        public void setProjecttype(NprojectType.PType pType)
        {
            thisPType = pType;
        }

        /// <summary>
        /// Sets the type of the C.
        /// </summary>
        /// <param name="ctype">The ctype.</param>
        /// <remarks></remarks>
        public void setCType(NprojectType.CType ctype)
        {
            thisCtype = ctype;
        }

        /// <summary>
        /// Gets the ctype.
        /// </summary>
        /// <returns></returns>
        /// <remarks></remarks>
        public NprojectType.CType getCtype()
        {
            return thisCtype;
        }

        /// <summary>
        /// Gets the projecttype.
        /// </summary>
        /// <returns></returns>
        /// <remarks></remarks>
        public NprojectType.PType getProjecttype()
        {
            return thisPType;
        }

        /// <summary>
        /// Adds the source.
        /// </summary>
        /// <param name="hSetting">The h setting.</param>
        /// <remarks></remarks>
        public void addSource(SourceSetting hSetting)
        {
            thisSetting = hSetting;
        }

        /// <summary>
        /// Adds the head.
        /// </summary>
        /// <param name="sSetting">The s setting.</param>
        /// <remarks></remarks>
        public void addHead(HeadSetting sSetting)
        {
            thishSetting = sSetting;
        }



        /// <summary>
        /// Checks the plat form.
        /// </summary>
        /// <param name="Value">The value.</param>
        /// <returns></returns>
        /// <remarks></remarks>
        private bool CheckPlatForm(string Value)
        {
            if (Value.Length > 0 && RegexPlatForm(Value))
            {
                return true;
            }
            return false;
        }

        /// <summary>
        /// Regexes the plat form.
        /// </summary>
        /// <param name="Value">The value.</param>
        /// <returns></returns>
        /// <remarks></remarks>
        private bool RegexPlatForm(string Value)
        {
            Regex pLatform = new Regex("android-*");
            if (pLatform.IsMatch(Value))
            {
                return true;
            }
            return false;
        }



        /// <summary>
        /// Gets the name of the project.
        /// </summary>
        /// <returns></returns>
        /// <remarks></remarks>
        public string getProjectName()
        {
            return pName;
        }





        /// <summary>
        /// Gets the head setting.
        /// </summary>
        /// <returns></returns>
        /// <remarks></remarks>
        public HeadSetting GetHeadSetting()
        {
            return thishSetting;
        }

        /// <summary>
        /// Gets the source setting.
        /// </summary>
        /// <returns></returns>
        /// <remarks></remarks>
        public SourceSetting GetSourceSetting()
        {
            return thisSetting;
        }

        /// <summary>
        /// Sets the depend header directory.
        /// </summary>
        /// <param name="DependHeaderDirectory">The depend header directory.</param>
        /// <remarks></remarks>
        public void SetDependHeaderDirectory(List<string> DependHeaderDirectory)
        {
            this.DependHeaderDirectory = DependHeaderDirectory;
        }
        /// <summary>
        /// Gets the depend header directory.
        /// </summary>
        /// <returns></returns>
        /// <remarks></remarks>
        public List<string> GetDependHeaderDirectory()
        {
            return DependHeaderDirectory;
        }


        /// <summary>
        /// Sets the depend libs directory.
        /// </summary>
        /// <param name="DependLibsDirectory">The depend libs directory.</param>
        /// <remarks></remarks>
        public void SetDependLibsDirectory(List<string> DependLibsDirectory)
        {
            this.DependLibsDirectory = DependLibsDirectory;
        }

        /// <summary>
        /// Gets the depend libs directory.
        /// </summary>
        /// <returns></returns>
        /// <remarks></remarks>
        public List<string> GetDependLibsDirectory()
        {
            return DependLibsDirectory;
        }
        /// <summary>
        /// Sets the out dir.
        /// </summary>
        /// <param name="OutDir">The out dir.</param>
        /// <remarks></remarks>
        public void  SetOutDir(string OutDir)
        {
              this.OutDir = OutDir;
        }
        /// <summary>
        /// Gets the out dir.
        /// </summary>
        /// <returns></returns>
        /// <remarks></remarks>
        public string GetOutDir()
        {
            return this.OutDir;
        }

        /// <summary>
        /// Setises the js.
        /// </summary>
        /// <param name="value">if set to <c>true</c> [value].</param>
        /// <remarks></remarks>
        public void SetisJs(bool value)
        {
            this.isJS = value;
        }

        /// <summary>
        /// Saves the VB.
        /// </summary>
        /// <param name="value">The value.</param>
        /// <remarks></remarks>
        public void SaveVB(string value)
        {
            this.VB = value;
        }

        /// <summary>
        /// Saves the js.
        /// </summary>
        /// <param name="value">The value.</param>
        /// <remarks></remarks>
        public void SaveJs(string value)
        {
            this.JS = value;
        }


        /// <summary>
        /// Gets the VB.
        /// </summary>
        /// <returns></returns>
        /// <remarks></remarks>
        internal string GetVB()
        {
            return VB;
        }

        /// <summary>
        /// Gets the JS.
        /// </summary>
        /// <returns></returns>
        /// <remarks></remarks>
        internal string GetJS()
        {
            return JS;

        }

        /// <summary>
        /// Gets the is JS.
        /// </summary>
        /// <returns></returns>
        /// <remarks></remarks>
        internal bool GetIsJS()
        {
            return isJS;
        }

        /// <summary>
        /// Saves the libs.
        /// </summary>
        /// <param name="hashtable">The hashtable.</param>
        /// <remarks></remarks>
        internal void SaveLibs(Hashtable hashtable)
        {
            userlibs = hashtable;
        }

        /// <summary>
        /// Saves the flags.
        /// </summary>
        /// <param name="hashtable">The hashtable.</param>
        /// <remarks></remarks>
        internal void SaveFlags(Hashtable hashtable)
        {
            userflags = hashtable;
        }

        /// <summary>
        /// Gets the flags.
        /// </summary>
        /// <returns></returns>
        /// <remarks></remarks>
        internal Hashtable GetFlags()
        {
            return userflags;
        }

        /// <summary>
        /// Gets the libs.
        /// </summary>
        /// <returns></returns>
        /// <remarks></remarks>
        internal Hashtable GetLibs()
        {
            return userlibs;
        }
    }
}
